package com.egao.api.controller.orderB;


import com.egao.common.core.annotation.OperLog;
import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.BaseController;
import com.egao.common.core.web.JsonResult;
import com.egao.common.system.service.OperRecordService;
import com.egao.orderB.entity.MaintainFeeAttach;
import com.egao.orderB.service.MaintainFeeAttachService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

//import com.egao.orderB.entity.Bill;
//import com.egao.orderB.service.BillService;

/**
 * api登录相关接口
 * Created by wangfan on 2019-05-29 下午 3:43.
 * http://localhost/swagger-ui.html
 * https://francjc.com:4332/swagger-ui.html
 */
@RequestMapping("/api/maintainFeeAttach")
@RestController
@Api(value = "附加费维护管理",tags = {"附加费维护管理"})
public class ApiMaintainFeeAttachController extends BaseController {

    @Autowired
    private OperRecordService operRecordService;
    @Autowired
    private MaintainFeeAttachService maintainFeeAttachService;

    /**
     * 附加费维护列表
     */
    @PreAuthorize("hasAuthority('orderB:maintainFeeAttach:list')")
    @PostMapping("/list")
    @ApiOperation(value = "附加费维护列表",notes = "" +
            "limit:每页显示几行 必填\n" +
            "page:第几页 必填\n" +
            "name:费用名\n" +
            "standard:标准\n" +
            "boxType:箱型\n" +
            "type:类型 平台 司机\n" +
            " \n" +
            "返回的内容\n" +
            "id:id\n" +
            "organizationId:组织id\n" +
            "name:费用名\n" +
            "standard:标准\n" +
            "boxType:箱型\n" +
            "price:金额\n" +
            "type:类型 1平台 2司机\n" +
            "atModules 模块 运费,提进,其他,单项,采购,报关费,易港通,财务报销\n" +
            "longitude:经度\n" +
            "latitude:纬度\n" +
            "radius:半径\n" +
            "yardDock:类型: 堆场,港口\n" +
            "remark:备注\n" +
            "createTime:创建时间\n" +
            "createUser:创建人\n" +
            "updateTime:更新时间\n" +
            "updateUser:更新人\n" +
            "deleted:del(0正常 1删除)\n" +
            "",httpMethod = "POST")
    public JsonResult list(PageResult2<T> page, MaintainFeeAttach maintainFeeAttach, HttpServletRequest request)  throws Exception{
        return maintainFeeAttachService.list(page, maintainFeeAttach, getLoginUser());
    }

    /**
     * 附加费维护列表
     */
    @PreAuthorize("hasAuthority('orderB:maintainFeeAttach:list')")
    @PostMapping("/listAll")
    @ApiOperation(value = "附加费维护列表",notes = "" +
            "name:费用名\n" +
            "standard:标准\n" +
            "boxType:箱型\n" +
            "type:类型 平台 司机\n" +
            "",httpMethod = "POST")
    public JsonResult listAll(MaintainFeeAttach maintainFeeAttach, HttpServletRequest request)  throws Exception{
        return maintainFeeAttachService.list(maintainFeeAttach, getLoginUser());
    }

    @PreAuthorize("hasAuthority('orderB:maintainFeeAttach:list')")
    @PostMapping("/getById")
    @ApiOperation(value = "附加费维护列表",notes = "id ",httpMethod = "POST")
    public JsonResult getById(MaintainFeeAttach maintainFeeAttach, HttpServletRequest request) {
        return maintainFeeAttachService.getById(maintainFeeAttach);
    }


    /**
     * 添加附加费维护
     */
    @PreAuthorize("hasAuthority('orderB:maintainFeeAttach:save')")
    @OperLog(value = "附加费维护管理", desc = "添加", result = true)
    @PostMapping("/save")
    @ApiOperation(value = "添加附加费维护",notes = "" +
            "name:费用名\n" +
            "standard:标准\n" +
            "boxType:箱型\n" +
            "price:金额\n" +
            "remark:备注\n" +
            "type:类型 平台 司机 必填\n" +
            "atModules 模块 运费,提进,其他,单项,采购,报关费,易港通,财务报销\n" +
            "longitude:经度\n" +
            "latitude:纬度\n" +
            "radius:半径\n" +
            "yardDock:类型: 堆场,港口\n" +
            "",httpMethod = "POST")
    public JsonResult save(MaintainFeeAttach maintainFeeAttach, HttpServletRequest request) {
        return maintainFeeAttachService.save(maintainFeeAttach, getLoginUser());
    }


    /**
     * 附加费维护修改
     */
    @PreAuthorize("hasAuthority('orderB:maintainFeeAttach:update')")
    @OperLog(value = "附加费维护管理", desc = "修改", result = true)
    @PostMapping("/update")
    @ApiOperation(value = "附加费维护修改",notes = "" +
            "id 附加费维护的id 必填\n" +
            "name:费用名\n" +
            "standard:标准\n" +
            "boxType:箱型\n" +
            "atModules 模块 运费,提进,其他,单项,采购,报关费,易港通,财务报销\n" +
            "price:金额\n" +
            "longitude:经度\n" +
            "latitude:纬度\n" +
            "radius:半径\n" +
            "yardDock:类型: 堆场,港口\n" +
            "remark:备注\n"
            ,httpMethod = "POST")
    public JsonResult update(MaintainFeeAttach maintainFeeAttach, HttpServletRequest request) {
        return maintainFeeAttachService.update(maintainFeeAttach, getLoginUser());
    }

    /**
     * 附加费维护删除
     */
    @PreAuthorize("hasAuthority('orderB:maintainFeeAttach:remove')")
    @OperLog(value = "附加费维护管理", desc = "删除")
    @PostMapping("/remove")
    @ApiOperation(value = "附加费维护删除",notes = "" +
            "id 附加费维护的id 必填\n"
            ,httpMethod = "POST")
    public JsonResult remove(MaintainFeeAttach maintainFeeAttach, HttpServletRequest request) {
        return maintainFeeAttachService.remove(maintainFeeAttach, getLoginUser());
    }


}
